<script>
import Vue from "vue";
import { qeuryRefundsList } from "@/lib/api/shopServer/info";
/**
 * vuex管理登陆状态，具体可以参考官方登陆模板示例
 */
import { mapMutations } from "vuex";

export default {
	globalData: {
		searchValue: false,
		// currentGoodsId: ""
		/*  */
		statusBarHeight:0,
		/*  */
	},

	onLaunch() {
		const userInfo = uni.getStorageSync("userInfo") || "";
		if (userInfo.customerId) {
			//更新登陆状态
			uni.getStorage({
				key: "userInfo",
				success: res => {
					this.saveLoginInfo(res.data);
				}
			});
		}
		const ZZgetLocation = uni.getStorageSync("ZZgetLocation") || "";
		if(ZZgetLocation){
			//更新获取位置信息状态
			uni.getStorage({
				key: "ZZgetLocation",
				success: res => {
					this.saveGetLocation(res.data);
				}
			});
		}
		//获取店铺信息
		this.getShopInfo();
		//获取顶部状态栏位置信息
		uni.getSystemInfo({
			success:function(e){
				console.log("---系统设备信息---",e);
				Vue.prototype.statusBar = e.statusBarHeight
				// #ifndef MP
				if(e.platform == 'android') {
					Vue.prototype.customBar = e.statusBarHeight + 50
				}else {
					Vue.prototype.customBar = e.statusBarHeight + 45
				}
				// #endif
				// #ifdef MP-WEIXIN
				let custom = wx.getMenuButtonBoundingClientRect()
				Vue.prototype.customTop = custom.top;
				Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight;
				// #endif
				// #ifdef MP-ALIPAY
				Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
				// #endif
			}
		});


		
		// 获取账号信息
		const accountInfo = wx.getAccountInfoSync();
		//console.log("---accountInfo---",accountInfo);
		this.saveAccountInfo(accountInfo.miniProgram);

	},
	onShow() {
		console.log("App Show");
	},
	onHide() {
		console.log("App Hide");
	},

	methods: {
		...mapMutations("shop", ["saveShopInfo"]),
		...mapMutations("login", ["saveLoginInfo","saveGetLocation","saveAccountInfo"]),

		async getShopInfo() {
			try {
				const res = await qeuryRefundsList();
				this.saveShopInfo(res.data);
				if (this.globalData.getShopInfoCallBack) {
					this.globalData.getShopInfoCallBack(res.data);
				}
			} catch (error) {
				console.log("getShopInfoError", error);
			}
		}
	}
};
</script>

<style lang='scss'>
/** theme begin */
@import "@/common/styles/template/main.scss";
@import "@/common/styles/template/flex.scss";
@import "@/common/styles/template/btn.scss"; 
/** theme end */
/* 图标库 */
@import "@/common/styles/iconFont.scss";
/* 20200727--新增S */
/* ---------------- */
.zz-status_bar {
	height:var(--status-bar-height);
	width:100%;
	background-color:red;
}
/* ----------------- navBar */
.zz-nav-wrap {
	position: fixed;
	z-index: 999;
	top: 0;
	left: 0;
	right: 0;
	height: 88rpx;
}
/* ------------------ */
.zz-container {
	position:relative;
	min-height:100vh;
}
/* ----------------- */
.zz-area {
	position:relative;
	background:$theme-panel-bg-color;
	box-shadow:0rpx 0rpx 14rpx 0rpx rgba(204,204,204,0.5);
	border-radius:16rpx;
	z-index:2;
	&_nobs {
		box-shadow:0rpx 0rpx 14rpx 0rpx transparent;
	}
	&_nobr {
		border-radius:0rpx;
	}
}
.zz-area_mh160 {min-height:160rpx;}
/* ---------------- */
.zz-img-fit {
	width:100%;
	height:100%;
	object-fit: cover;
	object-position: center;
}
/*  */
.zz-pos_abs {position:absolute;}
.zz-pos_rel {position:relative;}
.zz-hide {display:none;}
/* -------------- margin ----------------------- */
.zz-m {}
.zz-mb_0_16 {margin:0rpx 16rpx;}
.zz-mt2 {margin-top:2rpx;}
.zz-mt4 {margin-top:4rpx;}
.zz-mt22 {margin-top:22rpx;}
.zz-mt24 {margin-top:24rpx;}
.zz-mt26 {margin-top:26rpx;}
.zz-mt28 {margin-top:28rpx;}
.zz-mt32 {margin-top:32rpx;}
.zz-mt38 {margin-top:38rpx;}
.zz-mt60 {margin-top:60rpx;}
.zz-mt64 {margin-top:64rpx;}
.zz-mt72 {margin-top:72rpx;}
.zz-mr20 {margin-right:20rpx;}
.zz-mb6 {margin-bottom:6rpx;}
.zz-mb12 {margin-bottom:12rpx;}
.zz-mb16 {margin-bottom:16rpx;}
.zz-mb20 {margin-bottom:20rpx;}
.zz-mb24 {margin-bottom:24rpx;}
.zz-mb28 {margin-bottom:28rpx;}
.zz-mb30 {margin-bottom:30rpx;}
.zz-mb32 {margin-bottom:32rpx;}
.zz-mb40 {margin-bottom:40rpx;}
.zz-mb44 {margin-bottom:44rpx;}
.zz-mb48 {margin-bottom:48rpx;}
.zz-mb50 {margin-bottom:50rpx;}
.zz-mb60 {margin-bottom:60rpx;}
.zz-mb64 {margin-bottom:64rpx;}
.zz-mb72 {margin-bottom:72rpx;}
.zz-mb74 {margin-bottom:74rpx;}
.zz-mb80 {margin-bottom:80rpx;}
.zz-ml20 {margin-left:20rpx;}
.zz-ml24 {margin-left:24rpx;}
.zz-ml12 {margin-left:12rpx;}



/* --------------padding ------------------------ */
.zz-p {}
.zz-pt24 {padding-top:24rpx;}
.zz-pt120 {padding-top:120rpx;}
.zz-p_0_24 {padding:0rpx 24rpx;}
.zz-p_0_22 {padding:0rpx 22rpx;}
.zz-p_0_40 {padding:0rpx 40rpx;}
.zz-pb0_i {padding-bottom:0rpx !important;}
.zz-pb24 {padding-bottom:24rpx;}
/* ---------------top---------------------------- */
.zz-t1 {top:1rpx;}
.zz-t2 {top:2rpx;}
/* -------------- font-size--------------------- */
.fs22 {font-size:22rpx;}
.fs24 {font-size:24rpx;}
.fs26 {font-size:26rpx;}
.fs28 {font-size:28rpx;}
.fs30 {font-size:30rpx;}
.fs32 {font-size:32rpx;}
.fs34 {font-size:34rpx;}
.fs36 {font-size:36rpx;}
.fs42 {font-size:42rpx;}
.fs44 {font-size:44rpx;}
.fs48 {font-size:48rpx;}
.fs64 {font-size:64rpx;}
.fs76 {font-size:76rpx;}
.fs80 {font-size:80rpx;}
.fs128 {font-size:128rpx;}
.fs156 {font-size:156rpx;}
.fs-bold {font-weight:bold !important;}
/* ---------------line-height--------------------- */
.lh32 {line-height:32rpx;}
.lh34 {line-height:34rpx;}
.lh36 {line-height:36rpx;}
.lh38 {line-height:38rpx;}
.lh40 {line-height:40rpx;}
.lh44 {line-height:44rpx;}
.lh48 {line-height:48rpx;}
.lh50 {line-height:50rpx;}
.lh52 {line-height:52rpx;}
.lh58 {line-height:58rpx;}
.lh78 {line-height:78rpx;}
.lh96 {line-height:96rpx;}
.lh156 {line-height:156rpx;}
/* ---------------color---------------------------- */
.color000 {color:#000;}
.color333 {color:#333;}
.color666 {color:#666;}
.color999 {color:#999;}
.colorFFF {color:#fff;}
.color4A {color:#4A4A4A;}
.color795133 {color:#795113}
.colorC7A673 {color:#C7A673;}
/* ----------------- 间隔线 ------------------------ */
.zz-jg_line {
	position:absolute;
}
.zz-jg_line_v {
	top:0;
	width:1rpx;
	transform:scaleX(0.5);
}
.zz-jg_line_h {
	width:100%;
	height:1rpx;
	transform:scaleY(0.5);
}
.zz-jg_line_v_40 {
	height:40rpx;
}
.zz-jg_line_pos_r {
	right:0;
}
.zz-jg_line_pos_lt {
	left:0;
	top:0;
}
.zz-jg_line_pos_lb {
	left:0;
	bottom:0;
}
.zz-jg_line_bg {
	background-color:$theme-bd-color;
}
/* --------------- 输入框 ------------------ */
.zz-input-area {
	position:relative;
	border:2rpx solid transparent;
	border-radius:6rpx;
	&_fixed {
		position:fixed;
		left:38rpx;
		right:38rpx;
		bottom:0;
		background-color:#fff;
	}
	& > .input {
		position:absolute;
		top:0;
		left:0;
		width:100%;
		height:100%;
		padding-right:10rpx;
	}
}
.zz-input-area_size {
	/* width:654rpx; */
	height:100rpx;
	& > .input {
		padding:30rpx 40rpx;
	}
}
.zz-input-area_style {
	border-color:#eee;
	& > .input {
		font-size:28rpx;
		line-height:40rpx;
		color:#666;
	}
}
/* 20200727--新增E */
page {
	background-color: $theme-main-bg-color;
	height: 100%;
}

page {
	--safe-area-inset-top: 0rpx;
	--safe-area-inset-right: 0rpx;
	--safe-area-inset-bottom: 0rpx;
	--safe-area-inset-left: 0rpx;
}

@supports (top: constant(safe-area-inset-top)) {
	page {
		--safe-area-inset-top: constant(safe-area-inset-top);
		--safe-area-inset-right: constant(safe-area-inset-right);
		--safe-area-inset-bottom: constant(safe-area-inset-bottom);
		--safe-area-inset-left: constant(safe-area-inset-left);
	}
}

@supports (top: env(safe-area-inset-top)) {
	page {
		--safe-area-inset-top: env(safe-area-inset-top);
		--safe-area-inset-right: env(safe-area-inset-right);
		--safe-area-inset-bottom: env(safe-area-inset-bottom);
		--safe-area-inset-left: env(safe-area-inset-left);
	}
}

page {
	padding-bottom: var(--safe-area-inset-bottom);
}

view,
scroll-view,
swiper,
swiper-item,
cover-view,
cover-image,
icon,
text,
rich-text,
progress,
button,
checkbox,
form,
input,
label,
radio,
slider,
switch,
textarea,
navigator,
audio,
camera,
image,
video {
	box-sizing: border-box;
}

/* 骨架屏替代方案 */
.Skeleton {
	background: #f3f3f3;
	padding: 20rpx 0;
	border-radius: 8rpx;
}

/* 图片载入替代方案 */
.image-wrapper {
	font-size: 0;
	background: #f3f3f3;
	// border-radius: 4px;

	image {
		width: 100%;
		height: 100%;
		transition: 0.6s;
		opacity: 0;

		&.loaded {
			opacity: 1;
		}
	}
}

::-webkit-scrollbar {
	width: 0;
	height: 0;
	color: transparent;
}

.pop {
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	z-index: 998;
	background-color: rgba(0, 0, 0, 0.5);
}

.clamp {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: block;
}
.clamp2 {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.common-hover {
	background: #f5f5f5;
}

/*边框*/
.b-b:after,
.b-t:after {
	position: absolute;
	z-index: 3;
	left: 0;
	right: 0;
	height: 0;
	content: "";
	transform: scaleY(0.5);
	border-bottom: 2px solid $theme-bd-color;
}

.b-b:after {
	bottom: 0;
}

.b-t:after {
	top: 0;
}

/* button样式改写 */
uni-button,
button {
	// height: 80rpx;
	//   line-height: 1.1;
	background-color: transparent;
	margin: 0;
	padding: 0;
	font-weight: normal;
	&::after {
		border: 0;
	}
	&::before {
		border: 0;
	}
	&.no-border:before,
	&.no-border:after {
		border: 0;
	}
}

uni-button[type="default"],
button[type="default"] {
	color: $theme-color-main-base;
}

/* input 样式 */
.input-placeholder {
	color: #999999;
}

.placeholder {
	color: #999999;
}

/* 业务样式  start */
.cart-icon {
	width: 40rpx;
	height: 40rpx;
}

/* 业务样式  end */

/* flex区域 start */
.df {
	display: flex;
	align-items: center;
}

// [class*="df-"] {
//   display: flex;
// }

.df-c {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.df-r {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
}

.df-w {
	display: flex;
	flex-wrap: wrap;
}

.fw-w {
	flex-wrap: wrap;
}

.jc-fs {
	justify-content: flex-start;
}

.jc-c {
	justify-content: center;
}

.jc-sb {
	justify-content: space-between;
}

.jc-sa {
	justify-content: space-around;
}

.jc-fe {
	justify-content: flex-end;
}

.df1 {
	flex: 1;
}

.ai-fs {
	align-items: flex-start;
}

.ai-c {
	align-items: center;
}

.ac-sb {
	align-content: space-between;
}

.df-sa {
	justify-content: space-around;
}
/* align-self */
.as-s {
	align-self:stretch;
}
/* flex区域 end */

/* 首行缩进 */
.ti2 {
	text-indent: 2em;
}

// 中划线
.tdl {
	text-decoration: line-through;
}

/*单行超出省略*/
.txt-omit {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hv-cp {
	cursor: pointer;
}

/* 强制换行 */
.txt-wrap {
	word-wrap: break-word;
}

.tac {
	text-align: center;
}

.tar {
	text-align: right;
}

/* 容器 start */
.db {
	display: block;
}

.di {
	display: inline;
}

.dib {
	display: inline-block;
}

/* 容器 end */

/* 对齐方式 start */
.vam {
	vertical-align: middle;
}

.vat {
	vertical-align: top;
}

.vab {
	vertical-align: bottom;
}

/* 对齐方式 end */

/* 边框 start */
.bd {
	border: 2rpx solid #e6e6e6;
}

.bd-b {
	border-bottom: 2rpx solid #e6e6e6;
}

.bd-r {
	border-right: 2rpx solid #e6e6e6;
}

.bd-l {
	border-left: 2rpx solid #e6e6e6;
}

.bd-t {
	border-top: 2rpx solid #e6e6e6;
}

/* 边框 end */

/* 清除空格 */
.c-sp {
	font-size: 0;
}

.round {
	border-radius: 50%;
}

/* 定位 start */
.poa {
	position: absolute;
}

.por {
	position: relative;
}

.pos {
	position: static;
}

.pof {
	position: fixed;
}

/* 定位 end */
</style>
